﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using FeedAntGame.Sprite;
using Microsoft.Xna.Framework.Graphics;

namespace FeedAntGame.Control
{
    class AnimateText : BaseControl
    {
        public enum TYPE { READY, NEXT_LEVEL, GO, WIN, COMBO_X2, COMBO_X3, COMBO_X4 }
        TYPE type;

        
        /************************************************************************/
        /*                  GET/SET                                                                     */
        /************************************************************************/
        /// <summary>
        /// should use LoadingTextSprite
        /// </summary>
        internal override BaseSprite Sprite
        {
            get { return sprite; }
        }
        public TYPE Type
        {
            get { return type; }
            set 
            { 
                type = value;
                createInstance(sprite.Position);
            }
        }

        
        /************************************************************************/
        /*                  Constructor                                                                     */
        /************************************************************************/
        public AnimateText(Game game, TYPE type, Vector2 position)
            :base(game)
        {
            this.type = type;
            createInstance(position);
        }

        protected override void createInstance(Vector2 position)
        {
            switch (type)
            {      
                case TYPE.READY:
                    sprite = new LoadingTextSprite(Game.Content.Load<Texture2D>(@"Images\ready"), position,
                        new Point(300, 128), 0, Point.Zero, new Point(1, 1), Vector2.Zero, null,  1);
                    break;
                case TYPE.GO:
                    Texture2D goImage = Game.Content.Load<Texture2D>(@"Images\go");
                    sprite = new LoadingTextSprite(goImage, position,
                        new Point(300, 128), 0, Point.Zero, new Point(1, 1), Vector2.Zero, null,  1);
                    break;
                case TYPE.NEXT_LEVEL:
                    Texture2D nextLvImage = Game.Content.Load<Texture2D>(@"Images\next_level");
                    sprite = new LoadingTextSprite(nextLvImage, position,
                        new Point(300, 128), 0, Point.Zero, new Point(1, 1), Vector2.Zero, null, 1);
                    break;
                case TYPE.WIN:
                    Texture2D winImage = Game.Content.Load<Texture2D>(@"Images\win");
                    sprite = new LoadingTextSprite(winImage, position,
                        new Point(300, 128), 0, Point.Zero, new Point(1, 1), Vector2.Zero, null, 1);
                    break;
                case TYPE.COMBO_X2:
                    sprite = new LoadingTextSprite(Game.Content.Load<Texture2D>(@"Images\combo_x2"), position,
                        new Point(100, 40), 0, Point.Zero, new Point(1, 1), new Vector2(0, 0.1f), null, 1);
                    break;
                case TYPE.COMBO_X3:
                    sprite = new LoadingTextSprite(Game.Content.Load<Texture2D>(@"Images\combo_x3"), position,
                        new Point(100, 40), 0, Point.Zero, new Point(1, 1), new Vector2(0, 0.1f), null, 1);
                    break;
                case TYPE.COMBO_X4:
                    sprite = new LoadingTextSprite(Game.Content.Load<Texture2D>(@"Images\combo_x4"), position,
                        new Point(100, 40), 0, Point.Zero, new Point(1, 1), new Vector2(0, 0.1f), null, 1);
                    break;
            }
        }

        public bool Equals(AnimateText.TYPE type)
        {
            if (this.type == type)
            {
                return true;
            }
            return false;
        }
    }
}
